import { _decorator, Component, math, Node } from 'cc';
import { VirtualInput } from '../VirtualInput';
import { PlayerMoveState } from './PlayerMoveState';
import { Player } from './Player';
import { PlayerStateMachine } from './PlayerStateMachine';
import { PlayerState } from './PlayerState';
const { ccclass, property } = _decorator;

@ccclass('PlayerIdleState')
export class PlayerIdleState extends PlayerState {
    constructor(_player: Player, _stateMachine: PlayerStateMachine) {
        super(_player, _stateMachine);
    }

    override enter(): void {
        super.enter();
        this.rb.linearVelocity = math.Vec2.ZERO;
        this.player.playAnimation('daiji', true);
    }
    override update(dt: number): void {
        super.update(dt);
        if (this.player.input.length() > math.EPSILON) {
            this.stateMachine.changeState(this.player.moveState);
        }
    }
    override exit(): void {
        super.exit();
    }

}


